/*
 * Flashlib - QB9 common Flash library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.qb9.flashlib.fsm
{
	import flash.events.*;

	/**
	 * Definition of the action to be taken when an event occurs in a given state.
	 *
	 * <p>Methods pertaining to the ITransitionBuilder interface act as method chaining for the same methods in IState.</p>
	 */
	public interface Transition extends ITransitionBuilder
	{
		/**
		 * Define a callback method to be called when the transition is fired.
		 *
		 * <p>The callback method will receive the Event instance that provoked the transition.  The method can optionally:
		 * <ul>
		 * <li> return a String specifying the name of a state to switch to.</li>
		 * <li> call the Event.preventDefault() method to prevent the default state switch defined with <code>goto()</code>.</li>
		 * </ul>
		 * </p>
		 */
		function action(handler:Function):Transition;
		
		/**
		 * Define a default switch action to a given state.
		 */
		function goto(name:String):Transition;
	}
}

